#include <iostream>
#include <string>
#include <vector>

<<<<<<< HEAD
struct Review
{
	std::string title;
	int rating;
};

bool FillReview(Review &rr);
void ShowReview(const Review &rr);
=======
struct review
{
	std::string title;
	int rating;	
};

bool FillReview(review &rr);
void ShowReview(const review &rr);
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59

int main()
{
	using std::cout;
	using std::vector;
<<<<<<< HEAD
	vector<Review> books;

	Review temp;
=======
	vector<review> books;
	review temp;

>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
	while (FillReview(temp))
	{
		books.push_back(temp);
	}

	int num = books.size();
	if (num > 0)
	{
<<<<<<< HEAD
		cout << "Thanks you, you entered the following:\n" << "Rating\tBook\n";

=======
		cout << "Thank you ,you entered the following:\n" << "Rating\tBook\n";
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
		for (int i = 0; i < num; i++)
		{
			ShowReview(books[i]);
		}
<<<<<<< HEAD

		cout << "Reprising:\n" << "Rating\tBook\n";
		vector<Review>::iterator pr;
=======
		cout << "Reprising:\n" << "Rating\tBook\n";
		vector<review>::iterator pr;
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
		for (pr = books.begin(); pr != books.end(); pr++)
		{
			ShowReview(*pr);
		}
<<<<<<< HEAD
		vector<Review> oldlist(books);
=======
		vector<review> oldlist(books);
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
		if (num > 3)
		{
			books.erase(books.begin() + 1, books.begin() + 3);
			cout << "After erasure:\n";
<<<<<<< HEAD
			for (pr = books.begin(); pr != books.end(); pr++)
			{
				ShowReview(*pr);
			}

			books.insert(books.begin(), oldlist.begin() + 1, oldlist.begin() + 2);
=======
			for (pr = books.begin();pr != books.end(); pr++)
			{
				ShowReview(*pr);
			}
			books.insert(books.begin(),oldlist.begin() + 1,oldlist.begin() + 2);
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
			cout << "After insertion:\n";
			for (pr = books.begin(); pr != books.end(); pr++)
			{
				ShowReview(*pr);
			}
<<<<<<< HEAD

			books.swap(oldlist);
			cout << "Swapping oldlist with books:\n";
			for (pr = books.begin(); pr != books.end(); pr++)
			{
				ShowReview(*pr);
			}		
		}
		else
		{
			cout << "Nothing entered, nothing gained.\n";
		}
	}

	std::cin.get();
    return 0;
}

bool FillReview(Review &rr)
{
	std::cout << "Enter book title (quit to quit): ";
=======
		}

		books.swap(oldlist);
		cout << "Swapping oldlist with books:\n";
		for (pr = books.begin(); pr != books.end(); pr++)
		{
			ShowReview(*pr);
		}
	}
	else
	{
		cout << "Nothing entered,";
	}

	std::cin.get();

    return 0;
}

bool FillReview(review &rr)
{
	std::cout << "Enter book title (quit to quit):";
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
	std::getline(std::cin, rr.title);
	if (rr.title == "quit")
	{
		return false;
	}

	std::cout << "Enter book rating: ";
	std::cin >> rr.rating;
<<<<<<< HEAD
=======

>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
	if (!std::cin)
	{
		return false;
	}

	while (std::cin.get() != '\n')
	{
		continue;
	}

	return true;
}

<<<<<<< HEAD
void ShowReview(const Review &rr)
=======
void ShowReview(const review &rr)
>>>>>>> 6fafc451c11ae7b5347f0835dfeaf6966617ca59
{
	std::cout << rr.rating << "\t" << rr.title << std::endl;
}

